<template>
    <div>
        <div>
            <front-content :categories1="categories1"></front-content>
        </div>
        <my-footer-1></my-footer-1>
    </div>
</template>

<script>
import MyFooter1 from '../MyFooter1.vue'
import CategoryNav from './CategoryNav.vue';
import FrontContent from './FrontContent.vue';
import Heard from './Heard.vue';
import CatagoryItem from './products/CatagoryItem.vue'
export default {
  components: { MyFooter1, CatagoryItem,Heard, CategoryNav, FrontContent },
    name:'FrontIndex',

    mounted(){
        this.getCategoryByPId(0);//获取首页一级分类信息
        
    },
    data:function(){
        return{
            categories1:[],
        }
    },
    methods:{
        //获取首页一级分类信息
        getCategoryByPId(parentId){
            this.$axios({
                url:'/easybuy/category/'+parentId
            }).then(rs=>{
                this.categories1 = rs.data.categoryList;
                console.log("categories1",this.categories1);
            })
        },

    }
    
}
</script>
<style scoped>

</style>